1 using UnityEngine;
2 using
System.Collections;
3
4 public
class ScoreKeeper : MonoBehaviour
5 {
6     
public int score = 0;
7
8     
// Use this for initialization
9     
void Start()
10     {
11         DontDestroyOnLoad(gameObject);
12     }
13
14     
// Update is called once per frame
15     
void Update()
16     {
17     }
18
19     
public void IncrementScore(int amount)
20     {
21         score += amount;
22         AudioSource source = GetComponent<AudioSource>();
23         source.Play();
24     }
25 }


Gõ tìm kiếm nhanh...